#ifndef _djpeg_intf_H
#define _djpeg_intf_H


#ifdef __cplusplus
extern "C"
{
#endif

#include "cdjpeg.h"        /* Common decls for cjpeg/djpeg applications */

    enum
    {
        JPEG_ERR_NOERR = 0,
        JPEG_ERR_INCONSISTENCY = -1,
        JPEG_ERR_OUTPUTFORMAT = -2,
        JPEG_ERR_PARAMNOWALLOWED = -3,
    };


    typedef struct _JPEGDEC_
    {
        struct jpeg_decompress_struct   stInfo;
        struct jpeg_error_mgr           stErr;
        int nImgWidth;
        int nImgHeight;
        J_COLOR_SPACE   outclrspc;

    
    } JPEGDEC;

    int jpegdec_Init(JPEGDEC *pJpegDec);

    int jpegdec_Deinit(JPEGDEC *pJpegDec);

    int jpegdec_Predecode(JPEGDEC *pJpegDec, 
        unsigned char *pStream, int nStreamLen);
    
    int jpegdec_GetImageSize(JPEGDEC *pJpegDec, 
        int *pWidth, int *pHeight);

    int jpegdec_SetOutputColorSpace(JPEGDEC *pJpegDec,    
        J_COLOR_SPACE clrspc);

    int jpegdec_Decode(JPEGDEC *pJpegDec, unsigned char *pImage);

#ifdef __cplusplus
}
#endif



#endif  /* ifndef _djpeg_intf_H */
